package strategy_mode;

/**
 * Description: 测试
 *
 * @author code-worker
 * @date 2021/09/25 14:05
 */
public class StrategyPatternDemo {
    public static void main(String[] args) {
        Context context = new Context(new OperationAdd());
        System.out.println("10+5="+context.executeStrategy(10, 5));

        context = new Context(new OperationSubtract());
        System.out.println("10-5="+context.executeStrategy(10, 5));

        context = new Context(Integer::sum);
        System.out.println("10+5="+context.executeStrategy(10, 5));

        System.out.println("10+5="+context.executeStrategy(10, 5, Integer::sum));
    }
}
